<template>
  <!-- <div>{{ $route.meta.showTabbar }}</div> -->

  <router-view></router-view>

  <!-- $route.meta.showTabbar -->
  <!-- v-show="$route.meta.showTabbar == true" -->

  <!-- 利用页面的路由配置中通过meta  控制 这个页面是否需要tabbar -->
  <van-tabbar
    v-model="active"
    route
    active-color="#ee0a24"
    v-show="$route.meta.showTabbar == true"
    placeholder
  >
    <van-tabbar-item icon="home-o" to="/">首页</van-tabbar-item>
    <van-tabbar-item icon="search" to="/cate">分类</van-tabbar-item>
    <van-tabbar-item icon="shopping-cart-o" to="/cart" :badge="cartArr.length"
      >购物车</van-tabbar-item
    >
    <van-tabbar-item icon="setting-o" to="/my">我的</van-tabbar-item>
  </van-tabbar>
</template>

<script setup>
import { ref } from "vue";
import { cartArr, loadCartList } from "./store/cart";

let active = ref(0);
console.log();
let token = localStorage.getItem("xx-mall-token");
if (token) loadCartList();
</script>

<style></style>
